Repository navigation
fix(project): 勾选路径读取端补 null 防御与路径归一化 - #3
Merged
Merged
Conversation
checked_fields 字段名兼容 (8f4f793) 的两个遗留隐患: - get_string_element 对非字符串元素 (Flet 旧文件可能是对象数组) 返回 null: cli 端会把 null 收进 checked_paths, project_manager 端 File.new_for_path (null) 触发 G_IS_FILE critical, 循环内跳过 - 勾选匹配是字符串精确比较 (path in checked_files), Flet 若写 正斜杠/相对路径则勾选依然对不上: 读取端经 File.get_path () 归一化到本版规范形态, 相对路径按 work_dir 解析 (两处对称, 归一化逻辑放 ProjectManager.canonicalize_checked_path 共用)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
PR #2 (8f4f793) 做了 checked_files / checked_entries 字段名兼容, 审查发现两个遗留隐患, 本 PR 补齐:
get_string_element对非字符串元素 (Flet 旧文件可能是对象数组) 返回 null —— cli 端会把 null 收进checked_paths, project_manager 端File.new_for_path (null)触发G_IS_FILEcritical (Flatpak 测试环境 fatal-criticals 下直接 abort)。循环内跳过 null/空串。path in checked_files), Flet 若写正斜杠或相对路径则勾选依然对不上。读取端经File.get_path ()归一化到本版规范形态, 相对路径按项目文件的 work_dir 解析。归一化逻辑放ProjectManager.canonicalize_checked_path共用, cli 与 GUI 两处加载路径对称。写入端仍然不动 (只写 checked_files), 与 PR #2 的策略一致。
验证